﻿using System;
using System.Collections.Generic;
using System.Drawing;

namespace Alexus.DDrawScene
{
	public class Polygon
	{
		/// <summary>вершины полигона</summary>
		public LinkedList<PointF> _tops = new LinkedList<PointF>();
		public Polygon() { }
		public Polygon(LinkedList<PointF> Tops) { _tops = Tops; }
	
		public RectangleF GetBounds()
		{
			float l = float.MaxValue, r = float.MinValue, t = float.MaxValue, b = float.MinValue;
			foreach (PointF cur in _tops)
			{
				l = Math.Min(l, cur.X);
				r = Math.Max(r, cur.X);
				t = Math.Min(t, cur.Y);
				b = Math.Max(b, cur.Y);
			}
			return RectangleF.FromLTRB(l, t, r, b);

		}
	}

}
